<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Feedback extends Model {
	
	protected $table = 'feedbacks';
	protected $guarded = array('id');
	
	public function member() {
		return $this->belongsTo('App\Models\Member');
	}
	
	public function book() {
		return $this->belongsTo('App\Models\Book');
	}

	public function section() {
		return $this->belongsTo('App\Models\Section');
	}
	
	const STATUS_PENDING = 'pending';
	const STATUS_FINISHED = 'finished';
	
	public static $status = [
		self::STATUS_PENDING => '待处理',
		self::STATUS_FINISHED => '已解决',
	];
	
	public function status_ex() {
		return self::$status[$this->status];
	}
	
	public function isPending() {
		return ($this->status == self::STATUS_PENDING);
	}
}
